package com.kinggm.controller;

import com.kinggm.model.Person;
import com.kinggm.service.PersonService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/person")
public class PersonController {

    @Resource
    private PersonService personService;

    @GetMapping("save")
    public String save(@RequestParam("name") String name) {
        Person person = new Person();
        person.setName(name);
        personService.save(person);
        return "保存成功";
    }

}
